package com.zbkj.dal.base.enums;

import com.zbkj.dal.base.enums.show.EnumInterface;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

import java.util.Arrays;

@Getter
@AllArgsConstructor
public enum WithdrawStatusEnums implements EnumInterface<String> {
    WAIT_AUDIT("WAIT_AUDIT", "待审核"),
    AUDIT_PASS("AUDIT_PASS", "审核通过待打款"),
    AUDIT_REJECT("AUDIT_REJECT", "审核拒绝"),
    WITHDRAW_BACK("WIDTH_BACK", "提现退票"),
    SUCCESS("SUCCESS", "提现完成"),
    ;
    private final String code;
    private final String desc;

    public static String getDescByCode(String code) {
        if (StringUtils.isBlank(code)) {
            return null;
        }
        return Arrays.stream(WithdrawStatusEnums.values()).filter(e -> StringUtils.equals(e.getCode(), code)).map(WithdrawStatusEnums::getDesc).findFirst().orElse(null);
    }

    @Override
    public String code() {
        return code;
    }

    @Override
    public String desc() {
        return desc;
    }
}
